package com.baidu.project.chart7;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OptionalDataException;
import java.io.Serializable;

public class DataChart implements Serializable {
    private static final long serialVersionUID = 3672368913840301016L;
    private DataSet ds = new DataSet();
    public int number;
    public String color;
    public int data;

    public DataChart() {
    }

    public int getNumber() {
        return this.number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getColor() {
        return this.color;
    }

    public void setColor(String color) {
        this.color = color;
    }

    public int getData() {
        return this.data;
    }

    public void setData(int data) {
        this.data = data;
    }

    public DataSet getDs() {
        return this.ds;
    }

    public void setDs(DataSet ds) {
        this.ds = ds;
    }

    public String toString() {
        return "DataChart [number=" + this.number + ", color=" + this.color + ", data=" + this.data + "]";
    }

    public DataChart deepClone() throws IOException, ClassNotFoundException, OptionalDataException {
        ByteArrayOutputStream bao = new ByteArrayOutputStream();
        ObjectOutputStream oos = new ObjectOutputStream(bao);
        oos.writeObject(this);
        ByteArrayInputStream bis = new ByteArrayInputStream(bao.toByteArray());
        ObjectInputStream ois = new ObjectInputStream(bis);
        return (DataChart)ois.readObject();
    }
}